/*
 * Modbus slave mode data control.
 * Copyright (c) 2012  everyone
 * All rights reserved.
 * no limite
 */
#include "mbdatacb.h"
#include "mbinputdatacfg.h"
#include "par/par_tab.h"

uint16_t reg_hold_read(uint16_t Index);
uint16_t reg_hold_write(uint16_t Index, uint16_t Val);
extern const unsigned short mb_hold_dict[];

/*******************************************************************************
 * @brief  reg_hold_read
 * \param[in] Index : data address
 * @return  data
 * @ Pass/ Fail criteria: none
 *****************************************************************************/
uint16_t reg_hold_read(uint16_t Index)
{
	word_tt Val;
	if (Index < 320)
	{
		Val.uval = par_val_get(mb_hold_dict[Index]);
	}
	else
	{
		Val.uval = 0;
	}
	return Val.uVal;
}

/*******************************************************************************
 * @brief  reg_hold_write
 * \param[in] Index : data address
 * \param[in] Val : data
 * @return  data
 * @ Pass/ Fail criteria: none
 *******************************************************************************/
uint16_t reg_hold_write(uint16_t Index, uint16_t Val)
{

	return Val;
}
